arr = [false, true, true, false, false, false]
str = "1000000"
num = ''
for (let i = 0; i < arr.length; i++) {
    if (arr[i] == true) {
        str = str.slice(0, i + 1) + "1" + str.slice(i+2)
    }
    num = parseInt(str, 2)
}
console.log('str', str)
console.log('num', num)

str = num.toString(2);
console.log('str', str)
str = str.slice(0);
num = str.split("").map(Number).slice(1);

console.log('num', num)